//
//  TKL_VideoRootVC.m
//  TKL_EnPro
//
//  Created by 雅恩三河科技 on 2018/12/13.
//  Copyright © 2018年 MrZhang. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "TKL_VideoRootVC.h"
#import "TKL_VideoListVC.h"
#import "TKL_ImageDetailVC.h"
@interface TKL_VideoRootVC ()<NBLScrollTabControllerDelegate>
@property (nonatomic, strong) NBLScrollTabController *scrollTabController;
@property (nonatomic, strong) NSMutableArray *viewControllers;
@property (nonatomic, strong) TKL_VideoListVC *currentListVC;
@end

@implementation TKL_VideoRootVC
#pragma mark - getter and setter
- (NBLScrollTabController *)scrollTabController
{
    if (!_scrollTabController) {
        
        NBLScrollTabTheme *theme = [[NBLScrollTabTheme alloc] init];
        theme.titleViewHeight =WFCGFloatY(40);
        theme.titleViewBGColor = [UIColor whiteColor];
        theme.indicatorViewColor = Main_Color;
        theme.titleFont =SYSTEMFONT(15);
        theme.titleColor = HEXCOLOR(@"#323333");
        theme.highlightColor = Main_Color;
        
        _scrollTabController = [[NBLScrollTabController alloc] initWithTabTheme:theme];
        _scrollTabController.view.backgroundColor=[UIColor whiteColor];
        _scrollTabController.view.frame =CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT+49);
        _scrollTabController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        _scrollTabController.delegate = self;
        _scrollTabController.viewControllers = self.viewControllers;
        _scrollTabController.view.backgroundColor=[UIColor whiteColor];
    }
    return _scrollTabController;
}
- (NSMutableArray *)viewControllers
{
    if (!_viewControllers) {
        @WeakSelf;
        _viewControllers=[NSMutableArray new];
        NSArray* arr=@[@"内景样片",@"外景样片",@"旅拍样片",@"特色样片"];
        for (int i=0; i<arr.count; i++)
        {
            TKL_VideoListVC *demo0 = [[TKL_VideoListVC alloc] init];
            NBLScrollTabItem *demo0Item = [[NBLScrollTabItem alloc] init];
            demo0Item.title = arr[i];
            demo0Item.hideBadge = YES;//每个title可以做个性化配置
            demo0Item.textColor = HEXCOLOR(@"#323333");
            demo0Item.highlightColor = Main_Color;
            demo0.tabItem = demo0Item;
            demo0.view.backgroundColor=[UIColor whiteColor];
            demo0.view.height=self.scrollTabController.view.height-49*3;
            demo0.listCollection.height=self.scrollTabController.view.height-49*3;
            demo0.passType=[NSString stringWithFormat:@"%d",i+1];

             [_viewControllers addObject:demo0];
            if (i==0) {
                selfp.currentListVC=demo0;
                [demo0 refresdata];
            }
            demo0.handler = ^(BmobObject * _Nonnull obj) {
              
                TKL_ImageDetailVC* mm=[[TKL_ImageDetailVC alloc] init];
                mm.type=1;
                mm.passObj=obj;
                [self.navigationController pushViewController:mm animated:YES];
            };
   
        }
    }
    return _viewControllers;
}

#pragma mark - event
#pragma mark - method
-(void)initilization
{
    self.isGroup = YES;
    self.navigationItem.title =@"主题样片";
    [self.view addSubview:self.scrollTabController.view];
    self.navigationController.navigationBar.shadowImage = [[UIImage new]rt_darkenWithLevel:0.1f];
    self.view.backgroundColor=[UIColor whiteColor];
}
-(void)viewModelBand
{

}
-(void)reloadData
{

}
-(void)reloadView
{
    
}
#pragma mark - life
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initilization];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark - delegate
#pragma mark - NBLScrollTabControllerDelegate

- (void)tabController:(NBLScrollTabController * __nonnull)tabController
didSelectViewController:( UIViewController * __nonnull)viewController
{

    TKL_VideoListVC* vc=(TKL_VideoListVC*)viewController;
    self.currentListVC=vc;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [vc refresdata];
    });
}
@end


/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
